package week9;

import java.util.Scanner;

public class PP1201 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String str;
        String another = "y";

        while (another.equalsIgnoreCase("y")){

            System.out.println("输入回文: ");
            str = scan.next();
            Boolean a = palindrome(str);
            System.out.println(a);
            System.out.println("继续？（y/n）");
            another = scan.next();
        }
    }
    public static boolean palindrome(String string){
        Boolean b = true;
        if (string.length() > 1) {
            if (string.charAt(0) == string.charAt(string.length() - 1))
                b = true;
            else b = false;
            string = string.substring(1, string.length() - 1);
            palindrome(string);
        }
        else b = true;

        return b;
    }

}
